package mt.dummy;

import static org.junit.Assert.*;
import mt.Order;
import mt.comm.ServerSideMessage.Type;

import org.junit.AfterClass;
import org.junit.Test;

public class ClientCommDummyTest {

	ClientCommDummy clientComm  = new ClientCommDummy();
	ClientCommDummy clientComm2 =  new ClientCommDummy();
	ServerCommDummy serverComm= new ServerCommDummy();


	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Test
	public void testConnect() {
		clientComm.connect(null,"nickname");
		assertTrue(clientComm.isConnected());
	}

	@Test
	public void testIsConnected() {
		clientComm.connect(null, "nickname");
		assertTrue(clientComm.isConnected());
	}

	@Test
	public void testDisconnect() {
		clientComm.connect(null, "nickname");
		clientComm.disconnect();
	}

	@Test
	public void testGetNextMessage() {
		clientComm.getNextMessage();
		clientComm.addMessage(new ClientMessage("error"));
		clientComm.addMessage(new ClientMessage(Order.createBuyOrder("nickname", "stock", 10, 10.0)));
		clientComm.getNextMessage();


	}

	@Test
	public void testHasNextMessage() {
		clientComm.hasNextMessage();
		clientComm.addMessage(new ClientMessage("error"));
		clientComm.addMessage(new ClientMessage(Order.createBuyOrder("nickname", "stock", 10, 10.0)));
		clientComm.hasNextMessage();
	}

	@Test
	public void testSendOrder() {
		Order order = Order.createBuyOrder("nickname", "stock", 10, 10.0);
		clientComm.sendOrder(order);
	}

	@Test
	public void testAddMessage() {
		clientComm.addMessage(new ClientMessage("error"));
		clientComm.addMessage(new ClientMessage(Order.createBuyOrder("nickname", "stock", 10, 10.0)));
	}

}
